﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.JinShengService;

namespace CommunitySystem.PageView
{
    public partial class DelFAGWWindow : ChildWindow
    {
        private JinShengServiceClient _clien = new JinShengServiceClient();
        public DelFAGWWindow(JinShenMHelp jslist)
        {
            InitializeComponent();

            this.dg.ItemsSource = jslist.JinShen_MainInfos;
        }
        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton hbtn = sender as HyperlinkButton;

            var delItem = hbtn.Tag as JinShen_MainInfo;
           
            _clien.DeleJSCompleted -= new EventHandler<DeleJSCompletedEventArgs>(_clien_DeleJSCompleted);
            _clien.DeleJSCompleted += new EventHandler<DeleJSCompletedEventArgs>(_clien_DeleJSCompleted);
            _clien.DeleJSAsync(delItem.ID);

        }

        void _clien_DeleJSCompleted(object sender, DeleJSCompletedEventArgs e)
        {
            if (e.Result)
                SilverlightMessageBoxLibrary.Message.InfoMessage("删除成功！");
            else
                SilverlightMessageBoxLibrary.Message.InfoMessage("删除失败！");

            this.DialogResult = true;
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

